import React, { useState } from 'react';
import { Layout, Menu } from 'antd';
import { items } from "../../router/index";
import { Route, useNavigate } from 'react-router-dom';
const { Sider } = Layout;
const App: React.FC = () => {
    //跳转
    const Navigate = useNavigate()
    const changeUrl = ({ item, key, keyPath }: any) => {
       
        Navigate(key)
        localStorage.setItem("keypath", keyPath)
    }
    const keypath = localStorage.getItem("keypath")?(localStorage.getItem("keypath") as string).split(","):["/home"]
    return (
        <Sider trigger={null} collapsible collapsed={false}>
            <div className="logo" />
            <Menu
                theme="dark"
                mode="inline"
                defaultOpenKeys={keypath}
                defaultSelectedKeys={keypath}
                items={items}
                onClick={changeUrl}
            />
        </Sider>
    )
}
export default App;